package solutions.leetcode.easy

/**
 * @author lizhidong
 * <a href="https://leetcode.cn/problems/check-if-matrix-is-x-matrix/">2319. 判断矩阵是否是一个 X 矩阵</a>
 */
private class Solution2319 {
    fun checkXMatrix(grid: Array<IntArray>): Boolean {
        for ((i, line) in grid.withIndex()) {
            for ((j, item) in line.withIndex()) {
                if (i == j || i + j == grid.size - 1) {
                    if (item == 0) {
                        return false
                    }
                } else {
                    if (item != 0) {
                        return false
                    }
                }
            }
        }
        return true
    }
}

fun main() {
    
}